<?php

class Reale_Model_DbTable_AgentRegister extends Zend_Db_Table_Abstract
{
    /**
     * @var string Name of the database table
     */
    protected $_name = 'agent_register';
    
    protected function _disbursements($isDistributed = NULL) {
        $sql = 'SELECT `agent_register`.`agent_id`
    			, `agent`.`agent_reg_id`
    			, `agent`.`agent_name`
    			, `agent`.`rgrn_date`
    			, `agent_register`.`net_trans`
    			, `agent_register`.`is_distributed`
				FROM `agent_register`
    			INNER JOIN `agent` 
   		     		ON (`agent_register`.`agent_id` = `agent`.`agent_id`)
				WHERE (`agent_register`.`is_distributed` = ?)';
        if ($isDistributed) {
            $bind = array('1');
        } else {
            $bind = array('0');
        }
        return $this->getAdapter()->query($sql,$bind)->fetchAll();
    }
    
    public function fetchPendingDisbursements() {
        return self::_disbursements();
    }
}
